package com.example.mymusic;


import android.os.FileObserver;
import android.util.Log;



/**
 * @author xky
 */
public class SdCardListener extends FileObserver {

    public static int isDelete = 0;

    public SdCardListener(String path) {
        super(path);
    }


    public void pause() {
        isDelete = 1;
        Log.e("我是FileObserver：", String.valueOf(isDelete));
    }


    @Override
    public void onEvent(int event, String path) {
        switch (event) {
            case FileObserver.ALL_EVENTS:
                Log.d("all", "path:" + path);
                break;
            case FileObserver.CREATE:
                Log.d("Create", "path:" + path);
                break;
            case FileObserver.DELETE:
                pause();
                Log.e("Delete", "isDelete:" + isDelete);
                break;
            default:
                break;
        }
    }

}
